local joyex__qianya = fk.CreateSkill {

  name = "joyex__qianya",

  tags = {  },

}



joyex__qianya:addEffect(fk.TargetConfirmed, {
  name = "joyex__qianya",
  anim_type = "support",
  events = {fk.TargetConfirmed},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(joyex__qianya.name) and data.card.type == Card.TypeTrick and not player:isKongcheng()
  end,
  on_cost = function(self, event, target, player, data)
    local tos, cards = player.room:askForChooseCardsAndPlayers(player, 1, player:getHandcardNum(), table.map(player.room:getOtherPlayers(player), Util.IdMapper), 1, 1, ".", "#joyex__qianya-invoke", joyex__qianya.name, true)
    if #tos > 0 and #cards > 0 then
      event:setCostData(self, {tos[1], cards})
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    player.room:moveCardTo(event:getCostData(self)[2], Card.PlayerHand, player.room:getPlayerById(event:getCostData(self)[1]), fk.ReasonGive, joyex__qianya.name, "", true, player.id)
    local room = player.room
    local cards = room:getCardsFromPileByRule(".|.|.|.|.|^Equip")
    if #cards > 0 and not player.dead then
      local get = cards[1]
      local card = Fk:getCardById(get)
      room:obtainCard(player, get, false, fk.ReasonDraw)
    end
  end,
})

return joyex__qianya